
const path = require('path');
const CracoLessPlugin = require('craco-less');  //支持less
// 全局注入less变量文件
const cracoPluginStyleResourcesLoader = require('craco-plugin-style-resources-loader');
module.exports = {
  webpack: {
    alias: {//配置别名
      "@": path.join(__dirname, 'src'),
      'coms': path.join(__dirname, 'src/components'),
      'api': path.join(__dirname, 'src/api'),
      "public": path.join(__dirname, 'public'),
    },
  },
  plugins: [//配置less
    {
      plugin: CracoLessPlugin,
      options: {
        lessLoaderOptions: {
          lessOptions: {
            modifyVars: { '@primary-color': '#1DA57A' },//修改变量
            javascriptEnabled: true,
          },
        },
      },
    },
    {
      plugin: cracoPluginStyleResourcesLoader,
      options: {
        patterns: [
          path.join(__dirname, 'src/style/var.less')
        ],
        styleType: 'less'
      }
    },
  ]
}